package com.pixiv.MysqlDAO;

import com.pixiv.Interface.RegisterPicture;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

import static com.pixiv.MysqlDAO.CommonDAO.Factory;


public class RegisterDAO{

    public static SqlSessionFactory getFactory()
    {
        return Factory;
    }

    public static String getPictureInitName()
    {
        SqlSession s = getFactory().openSession();
        RegisterPicture RP = s.getMapper(RegisterPicture.class);
        int picID = (int)(RP.getSize() * Math.random());
        return RP.getNameByPictureID(picID );
    }


}
